package org.ww.config;

import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.ww.bean.Person;

@Configuration
//@ComponentScan(value = "org.ww",excludeFilters = {
//        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class,Service.class})
//})
@ComponentScan(value = "org.ww",includeFilters = {
        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class,Service.class})
},useDefaultFilters = false)
/**
 * @ComponentScan 扫描指定的包
 * excludeFilters 排除指定的配置类信息
 * includeFilters 包含指定的配置类信息，配置生效必须将spring默认规则禁用掉：useDefaultFilters = false
 */
public class MainConfig {

    @Bean("person1")   //默认方法名为bean  id，
    public Person person(){
        return new Person("ww",18);
    }
}
